import 'package:flutter/material.dart';
import 'package:player_plugin/video_speed.dart';

class VideoSpeedTip extends StatelessWidget {
  VideoSpeedTip({
    Key? key,
    VideoSpeedTipStyle? videoSpeedTipStyle,
    this.speed = '1.0X',
    this.hidden = true,
  })  : videoSpeedTipStyle = videoSpeedTipStyle ?? VideoSpeedTipStyle(),
        super(key: key);

  final VideoSpeedTipStyle videoSpeedTipStyle;
  final String speed;
  final bool hidden;

  @override
  Widget build(BuildContext context) {
    return Offstage(
      offstage: hidden,
      child: Align(
        alignment: videoSpeedTipStyle.alignment,
        child: Container(
          width: videoSpeedTipStyle.size.width,
          height: videoSpeedTipStyle.size.height,
          decoration: videoSpeedTipStyle.decoration,
          child: Row(
            mainAxisAlignment: MainAxisAlignment.center,
            children: [
              videoSpeedTipStyle.icon,
              Padding(
                padding: videoSpeedTipStyle.middlePadding,
                child: Text(
                  speed,
                  style: videoSpeedTipStyle.speedTextStyle,
                ),
              ),
              Text(
                videoSpeedTipStyle.describe,
                style: videoSpeedTipStyle.describeTextStyle,
              ),
            ],
          ),
        ),
      ),
    );
  }
}
